CAS: gc scheduler stop join race - #2326
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@k-morozov , could you describe a scenario that requires this hardening? |
Not quite. Start and stop have a guard on the level above in current design. Data race related with requestRoundSoon (checking joinable without lock). |
0e85e88 to
74c6f96
Compare
Umbrella review: PR #2326 "CAS: gc scheduler stop join race"Head SummaryThe PR closes the reachable data race between The PR also bundles a second, separable fix: No blockers. Verdict: request changes (minor). Major1. The targeted race is fixed but never exercised, and TSan is excluded
2.
|
| Group | Count | Cause |
|---|---|---|
Shard 1: Server died and the 41 tests killed with it |
41 | Step 4 (mount fenced by the memory storm, DROP hang) |
Shard 2: MEMORY_LIMIT_EXCEEDED, Connection reset, mutation failure in 02352, Cannot initialize connection |
~55 | Step 2 |
Shard 2: result differs in pipeline-shape tests (03403, 03927, 04105, 02286, 02377, 02981, 00965, 01883, 02210, 01861, 03402, 04040, 04337) |
13 | Step 3 |
Shard 2: 7 BROKEN timeouts |
7 | Already marked KNOWN: Random timeout with sanitizer by CI |
Shard 2: Some queries hung |
1 | End-of-run hung check during a storm minute; not separately root-caused |
Nothing references CasGcScheduler, GC start/stop or requestRoundSoon; unit tests are green with both new tests passing.
Fixes that follow from the evidence
MemoryWorkernon-jemalloc branch: on a negative tracker amount reset to 0 (or log and keep) instead of snapping to ASan RSS. This removes steps 2 to 4 entirely on sanitizer lanes.- Dynamic hard limit: floor at
max(RSS, tracker amount) + margin, otherwise the limit can sit below what the tracker already accounts for and every allocation fails. - CAS lease renewal and pool-identity probe: these control-plane reads must not depend on a 4 MiB tracked buffer; read with a small buffer or under
MemoryTrackerBlockerInThread, so memory pressure degrades queries, not mount liveness. Losing the mount to a transient allocation failure is a fail-closed cascade that turns every DROP into an infinite wait. - Open sub-question: why only the CAS lane dips below zero (plain ASan lanes never do). Discriminator: watch
MemoryTrackingUncorrectedon a local ASan run with--cas-s3-storageand bisect which allocation path frees more than it tracked.
Regression suites
cas_selects: the known port-exhaustion cause (compact parts plus column-subset reads reset every S3 connection). cas_alter_attach_3 and cas_s3_cache_lightweight_delete_4 fail the same scenarios on merged base PR #2327; their root cause was not established in this review and needs its own investigation.
Verdict
Request changes (minor). Minimum actions:
- Clear
round_requestedin thestartrollback path. - Fix the two stale
stoppingcomments and the "does not block" comment at thegcStartcall site. - Comment
threads_mutex; document thestartthrow/retry contract. - Add the concurrent
requestRoundSoonvsstoptest and run the branch once with TSan enabled. - Update the PR description with the half-start scenario.
Signed-off-by: Konstantin Morozov <just.morozov.k@gmail.com>
Details
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed races in the CAS GC scheduler lifecycle and made SYSTEM CAS GC START recover safely from worker scheduling failures.
Documentation entry for user-facing changes
...
CI/CD Options
Exclude tests:
Regression jobs to run: